<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>天气案例</title>
  <script src="../js/vue.js"></script>
</head>
<body>
<div class="app">
  <h2>今天天气很 {{info}}</h2>
  <button @click="changeWeather">切换</button>
</div>
</body>
<script>
  Vue.config.productionTip = false
  const vm = new Vue({
    el: '.app',
    data: {
      isHot: false
    },
    methods: {
      changeWeather() {
        this.isHot = !this.isHot
      }
    },
    computed: {
      info() {
        return this.isHot ? '炎热' : '凉爽'
      }
    }
  })
</script>
</html>